package com.gy.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gy.entity.research.Longitudinal;
import com.gy.entity.result.Papers;
import com.gy.vo.completed.ResultsCountVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface LongitudinalMapper extends BaseMapper<Longitudinal> {
    int updateLongitudinal(Longitudinal longitudinal);

    boolean saveLongitudinal(Longitudinal longitudinal);

    List<Longitudinal> selectLongitudinalBatchIds(List<Long> list);

    Longitudinal selectLongitudinalById(Long id);


    @Select("SELECT title,id,pdf_url FROM result_papers WHERE user_id = #{userId} AND project_id = #{projectId}")
    List<ResultsCountVO> selectPapersByUserIdAndProjectId(@Param("userId") Long userId, @Param("projectId") Long projectId);

    @Select("SELECT title,id,pdf_url FROM result_patents WHERE user_id = #{userId} AND project_id = #{projectId}")
    List<ResultsCountVO> selectPatentsByUserIdAndProjectId(@Param("userId") Long userId, @Param("projectId") Long projectId);
    @Select("SELECT title,id,pdf_url FROM result_personal_award WHERE user_id = #{userId} AND project_id = #{projectId}")
    List<ResultsCountVO> selectPersonalAwardByUserIdAndProjectId(@Param("userId") Long userId, @Param("projectId") Long projectId);
    @Select("SELECT title,id,pdf_url FROM result_report WHERE user_id = #{userId} AND project_id = #{projectId}")
    List<ResultsCountVO> selectReportByUserIdAndProjectId(@Param("userId") Long userId, @Param("projectId") Long projectId);
    @Select("SELECT title,id,pdf_url FROM result_copyright WHERE user_id = #{userId} AND project_id = #{projectId}")
    List<ResultsCountVO> selectCopyRightByUserIdAndProjectId(@Param("userId") Long userId, @Param("projectId") Long projectId);
    @Select("SELECT title,id,pdf_url FROM result_student_award WHERE user_id = #{userId} AND project_id = #{projectId}")
    List<ResultsCountVO> selectStudentAwardByUserIdAndProjectId(@Param("userId") Long userId, @Param("projectId") Long projectId);
    @Select("SELECT title,id,pdf_url FROM result_continuing_education_material WHERE user_id = #{userId} AND project_id = #{projectId}")
    List<ResultsCountVO> selectContinuingByUserIdAndProjectId(@Param("userId") Long userId, @Param("projectId") Long projectId);
    @Select("SELECT title,id,pdf_url FROM result_publication WHERE user_id = #{userId} AND project_id = #{projectId}")
    List<ResultsCountVO> selectPublicationByUserIdAndProjectId(@Param("userId") Long userId, @Param("projectId") Long projectId);
}
